import request from '@u/request'
const UserModule = 'user'
// 获取部门树
export function getDepartmentTree() {
  return request.get(`${UserModule}/department/getDepartmentTree`)
}

// 添加部门
export function addDepartment(data) {
  return request.post(`${UserModule}/department/add`, JSON.stringify(data))
}

// 编辑部门
export function updateDepartment(id, data) {
  return request.put(
    `${UserModule}/department/update/${id}`,
    JSON.stringify(data)
  )
}

// 删除部门
export function deleteDepartment(pkid) {
  return request.delete(`${UserModule}/department/delete`, {
    params: {
      pkid,
    },
  })
}

// 搜索部门
export function searchDepartment(pkid) {
  return request.get(`${UserModule}/department/delete`, {
    params: {
      pkid,
    },
  })
}
